/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LoggerFrame.java
 *
 * Created on 26.11.2009, 13:55:36
 */

package gui;

import java.util.ArrayList;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import models.LoggerComboBoxModel;
import network.ReplayServer;

/**
 *
 * @author tscheinecker
 */
public class LoggerFrame extends javax.swing.JFrame {

    private LoggerComboBoxModel comboBoxModel;

    /** Creates new form LoggerFrame */
    public LoggerFrame() {
        ArrayList<Class> classes = new ArrayList<Class>();
        classes.add(ReplayServer.class);
        classes.add(ConnectTagDialog.class);

        comboBoxModel = new LoggerComboBoxModel(classes);

        initComponents();

        // Listener
        comboBoxModel.addListDataListener(comboBoxListener);
    }

    private ListDataListener comboBoxListener = new ListDataListener() {

        public void intervalAdded(ListDataEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void intervalRemoved(ListDataEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void contentsChanged(ListDataEvent e) {
            loggerTextPane.setText(comboBoxModel.getSelectedItem().toString());
        }
    };

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jComboBox1 = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        loggerTextPane = new javax.swing.JTextPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jComboBox1.setModel(comboBoxModel);

        jScrollPane1.setViewportView(loggerTextPane);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 609, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LoggerFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextPane loggerTextPane;
    // End of variables declaration//GEN-END:variables

}
